#!/usr/bin/env python3
# -*- coding:utf-8 -*-
import time

from page.webpage import WebPage, sleep
from utils.logger import log


class LoginPage(WebPage):
    """登录页"""

    def __init__(self,driver):
        super().__init__(driver)
        self.path='/login'
        self.loginEles=self.eles.login


    def input_username(self,content):
        """输入用户名"""
        self.input_text(self.loginEles.usernameBox, txt=content)
        # sleep()

    def input_password(self, content):
        """输入密码"""
        self.input_text(self.loginEles.passwordBox, txt=content)
        # sleep()


    # @property
    # def imagine(self):
    #     """搜索联想"""
    #     return [x.text for x in self.find_elements(loginEles.passwordBox)]

    def click_loginBtn(self):
        """点击搜索"""
        self.click(self.loginEles.loginBtn)


if __name__ == '__main__':
    from selenium import webdriver
    driver=webdriver.Edge()
    p=LoginPage(driver)
    p.open()
    p.input_username('dragon')
    p.input_password('qwer12341')
    p.click_loginBtn()
    time.sleep(1)
    r=p.find_element('class==ph-message.ph-message-error').text
    print(r)
    # sleep(2)



